/*
*
* */
Rsd.define('Rsd.Faith.pages.BankZengZhiTouZiListPage', {
    extend: 'Rsd.Faith.pages.ListPage',
    requires: ['Rsd.controlEx.ComboBoxEnum','Rsd.Faith.controls.SuoShuQiInput'],
    xtype: 'list-tou-zi',
    border: false,
    formTitle: '增值投资',
    searchColumns:[{name:'YinHangBianHao',text:'银行账号'}],
    newButtons:[{text:'新增投资',handler:'newItem'}],
    modelType: 'BankZengZhiTouZiModel',
    readOnly:false,
    sort:[{name:'KaiShiRiQi',direction:'desc'}],
    formFields: [
        {
            "name": "YinHangMingCheng",
            "label": {
                "width": 80,
                "content": "银行名称"
            },
            "dataIndex": "YinHangMingCheng",
            "index": 20,
            "exist": true,
            "xtype": "text",
            "length": 100
        },
        {
            "name": "YinHangZhangHao",
            "label": {
                "width": 80,
                "content": "银行账号"
            },
            "dataIndex": "YinHangZhangHao",
            "index": 20,
            "exist": true,
            "xtype": "text",
            "length": 50
        },
        {
            "name": "KaiShiRiQi",
            "label": {
                "width": 80,
                "content": "开始日期"
            },
            "dataIndex": "KaiShiRiQi",
            "index": 22,
            "exist": true,
            "xtype": "text",
            "length": 256
        },
        {
            "name": "DaoQiRiQi",
            "label": {
                "width": 80,
                "content": "到期日期"
            },
            "dataIndex": "DaoQiRiQi",
            "index": 24,
            "exist": true,
            "xtype": "text",
            "length": 256
        },
        {
            "name": "BenJin",
            "label": {
                "width": 80,
                "content": "本金"
            },
            "dataIndex": "BenJin",
            "index": 26,
            "exist": true,
            "xtype": "number",
            "precision": 2
        },
        {
            "name": "TouZiFangShi",
            "label": {
                "width": 80,
                "content": "投资方式"
            },
            "dataIndex": "TouZiFangShi",
            "index": 42,
            "exist": true,
            "xtype": "text",
            "length": 10
        },
        {
            "name": "YuQiLiLv",
            "label": {
                "width": 80,
                "content": "预期收益利率((%))"
            },
            "dataIndex": "YuQiLiLv",
            "index": 28,
            "exist": true,
            "xtype": "number",
            "precision": 2
        },
        {
            "name": "YueShu",
            "label": {
                "width": 80,
                "content": "月数"
            },
            "dataIndex": "YueShu",
            "index": 30,
            "exist": true,
            "xtype": "number",
            "precision": 0
        },
        {
            "name": "YuJiShouYi",
            "label": {
                "width": 80,
                "content": "预计收益"
            },
            "dataIndex": "YuJiShouYi",
            "index": 32,
            "exist": true,
            "xtype": "number",
            "precision": 2
        },

        {
            "name": "JieSuanShouYi",
            "label": {
                "width": 80,
                "content": "结算收益"
            },
            "dataIndex": "JieSuanShouYi",
            "index": 36,
            "exist": true,
            "xtype": "number",
            "precision": 2
        },
        {
            "name": "JieSuanBenXiHeJi",
            "label": {
                "width": 80,
                "content": "本息合计"
            },
            "dataIndex": "JieSuanBenXiHeJi",
            "index": 38,
            "exist": true,
            "xtype": "number",
            "precision": 2
        },
        {
            "name": "JieSuanRiQi",
            "label": {
                "width": 80,
                "content": "结算日期"
            },
            "dataIndex": "JieSuanRiQi",
            "index": 40,
            "exist": true,
            "xtype": "text",
            "length": 256
        },
        {
            "name": "ZhuangTai",
            "label": {
                "width": 80,
                "content": "状态"
            },
            "dataIndex": "ZhuangTai",
            "index": 42,
            "exist": true,
            "xtype": "combobox-enum",
            enum:'Rsd.Faith.Core.TouZiZhuangTai',
            "length": 256
        },
        {
            "name": "Remark",
            "label": {
                "width": 80,
                "content": "备注"
            },
            "dataIndex": "Remark",
            "index": 200,
            "exist": true,
            "xtype": "text",
            "length": 100
        }
    ],
    gridColumns: [
        {
            "text": "序号",
            "xtype": "index",
            "width": 40,
            "index": 0
        },
        {
            "name": "YinHangMingCheng",
            "dataIndex": "YinHangMingCheng",
            "sortable": false,
            "text": "银行名称",
            "index": 20,
            "exist": true,
            "xtype": "string",
            "width": 100,
            "nobr": true
        },
        {
            "name": "YinHangZhangHao",
            "dataIndex": "YinHangZhangHao",
            "sortable": false,
            "text": "银行账号",
            "index": 20,
            "exist": true,
            "xtype": "string",
            "width": 150,
            "nobr": true
        },
        {
            "name": "KaiShiRiQi",
            "dataIndex": "KaiShiRiQi",
            "sortable": false,
            "text": "开始日期",
            "index": 22,
            "exist": true,
            "xtype": "string",
            "width": 150,
            "nobr": true
        },
        {
            "name": "DaoQiRiQi",
            "dataIndex": "DaoQiRiQi",
            "sortable": false,
            "text": "到期日期",
            "index": 24,
            "exist": true,
            "xtype": "string",
            "width": 150,
            "nobr": true
        },
        {
            "name": "YueShu",
            "dataIndex": "YueShu",
            "sortable": false,
            "text": "月数",
            "index": 30,
            "exist": true,
            "xtype": "number",
            "width": 60,
            "precision": 0
        },
        {
            "name": "BenJin",
            "dataIndex": "BenJin",
            "sortable": false,
            "text": "本金",
            "index": 26,
            "exist": true,
            "xtype": "number",
            "width": 150,
            "precision": 2
        },
        {
            "name": "TouZiFangShi",
            "dataIndex": "TouZiFangShi",
            "sortable": false,
            "text": "投资方式",
            "index": 42,
            "exist": true,
            "xtype": "string",
            "width": 100,
            "nobr": true
        },
        {
            "name": "YuQiLiLv",
            "dataIndex": "YuQiLiLv",
            "sortable": false,
            "text": "预期收益率(%)",
            "index": 28,
            "exist": true,
            "xtype": "number",
            "width": 100,
            "precision": 2
        },

        {
            "name": "YuJiShouYi",
            "dataIndex": "YuJiShouYi",
            "sortable": false,
            "text": "预计收益",
            "index": 32,
            "exist": true,
            "xtype": "number",
            "width": 100,
            "precision": 2
        },

        {
            "name": "JieSuanShouYi",
            "dataIndex": "JieSuanShouYi",
            "sortable": false,
            "text": "结算收益",
            "index": 36,
            "exist": true,
            "xtype": "number",
            "width": 100,
            "precision": 2
        },
        {
            "name": "JieSuanBenXiHeJi",
            "dataIndex": "JieSuanBenXiHeJi",
            "sortable": false,
            "text": "本息合计",
            "index": 38,
            "exist": true,
            "xtype": "number",
            "width": 150,
            "precision": 2
        },
        {
            "name": "JieSuanRiQi",
            "dataIndex": "JieSuanRiQi",
            "sortable": false,
            "text": "结息日期",
            "index": 40,
            "exist": true,
            "xtype": "string",
            "width": 100,
            "nobr": true
        },

        {
            "name": "ZhuangTai",
            "dataIndex": "ZhuangTai",
            "sortable": false,
            "text": "状态",
            "index": 34,
            "exist": true,
            "xtype": "enum",
            "enum": {
                "name": "Rsd.Faith.Core.TouZiZhuangTai",
                "items": [
                    {
                        "code": "DJ",
                        "text": "已登记",
                        "value": 0,
                        color:'green'
                    },
                    {
                        "code": "JS",
                        "text": "已结算",
                        "value": 1
                    },
                    {
                        "code": "RZ",
                        "text": "已入账",
                        "value": 2,
                        color:'blue'
                    }
                ]
            },
            "format":"format_zhuang_tai",
            "width": 80,
            "nobr": true
        },
        {
            "name": "Remark",
            "dataIndex": "Remark",
            "sortable": false,
            "text": "备注",
            "index": 200,
            "exist": true,
            "xtype": "string",
            "width": 100,
            "nobr": true
        }
    ],
    titleField : 'FaPiaoBianHao',
    formFieldsShouRu:[
        {
            "name": "YinHangMingCheng",
            "label": {
                "width": 80,
                "content": "银行名称"
            },
            "dataIndex": "YinHangMingCheng",
            "index": 20,
            "exist": true,
            "xtype": "text",
            "length": 10
        },
        {
            "name": "YinHangZhangHao",
            "label": {
                "width": 80,
                "content": "银行账户"
            },
            "dataIndex": "YinHangZhangHao",
            "index": 20,
            "exist": true,
            "xtype": "text",
            "length": 100
        },
        {
            "name": "RiQi",
            "label": {
                "width": 80,
                "content": "结息日期"
            },
            "dataIndex": "RiQi",
            "index": 24,
            "exist": true,
            "xtype": "text",
            "length": 30
        },
        {
            "name": "JinE",
            "label": {
                "width": 80,
                "content": "金额"
            },
            "dataIndex": "JinE",
            "index": 28,
            "exist": true,
            "xtype": "number",
            "precision": 2
        },
        {
            "name": "ZhaiYao",
            "label": {
                "width": 80,
                "content": "摘要"
            },
            "dataIndex": "ZhaiYao",
            "index": 30,
            "exist": true,
            "xtype": "text",
            "length": 200
        },
        {
            "name": "SuoShuQi",
            "label": {
                "width": 80,
                "content": "归属所属期"
            },
            "dataIndex": "SuoShuQi",
            "index": 23,
            "exist": true,
            xtype:'ctrl-suoshuqi',
            "length": 20
        },
        {
            "name": "Remark",
            "label": {
                "width": 80,
                "content": "备注"
            },
            "dataIndex": "Remark",
            "index": 200,
            "exist": true,
            "xtype": "text",
            "length": 100
        }
    ],
    /*
     * */
    constructor: function (config) {
        config = config || {};
        Rsd.apply(this, config);
    },
    format_zhuang_tai:function (row) {
        var me = this;
        if(row['ZhuangTai']=='DJ')
        {
            return [Rsd.newLine(),Rsd.button('结算',function () {
                Rsd.app.showModelView('BankZengZhiShouYiModel',
                    me.formFieldsShouRu,
                    {
                        YinHangMingCheng:row['YinHangMingCheng'],
                        YinHangZhangHao:row['YinHangZhangHao'],
                        RiQi:row['JieSuanRiQi'],
                        JinE:row['JieSuanShouYi'],
                        ZhaiYao:'定存增值收入'

                    },
                    '增值收入结算',
                    ['cancel','save'],
                    false,
                    me);
            })];
        }
       return [];
    }


});